<template>
  <view class="page-wapper">
    <view class="">视频页面</view>
    <button @click="back">返回</button>
  </view>
</template>

<script setup>
import { onMounted, onUnmounted } from 'vue';
import { sendLog, viewLog } from '@/common/js/utils/index.js';

const isH5 = uni.getSystemInfoSync().platform === 'h5';
const back = () => {
  console.log('点击了返回页面');
  uni.navigateBack();
};

// 监听返回按钮事件
const handleBackPress = () => {
  console.log('监听到返回按钮点击');
  // 在这里可以添加自定义逻辑
  // 返回 true 表示阻止默认返回行为，返回 false 或不返回则继续默认行为
  return true; // 阻止默认返回行为
};

onMounted(() => {
  viewLog({
    msg: '28-onMounted'
  });
  const isH5 = uni.getSystemInfoSync().platform === 'h5';
  viewLog({
    isH5: isH5
  });

  if (isH5) {
    viewLog({
      name: 'bpoxue',
      isH5: 'true'
    });
  } else {
    viewLog({
      name: '1231312',
      isH5: 'false'
    });
  }
});

onUnmounted(() => {
  // uni.offBackPress(handleBackPress);
});
</script>

<style lang="scss" scoped></style>
